package com.enjoyor.soa.traffic.server.tsms.dubbo.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;

import com.alibaba.dubbo.common.json.JSONObject;
import com.alibaba.dubbo.config.annotation.Service;
import com.enjoyor.soa.traffic.api.dto.tsms.RltRoutePostDto;
import com.enjoyor.soa.traffic.api.service.dubbo.tsms.IDubboRltRoutePostService;
import com.enjoyor.soa.traffic.core.tsms.domain.RltRoutePost;
import com.enjoyor.soa.traffic.core.tsms.service.IRltRoutePostService;
import com.enjoyor.soa.traffic.frame.support.util.DomainUtil;
import com.enjoyor.soa.traffic.util.helper.ReflectHelper;
import com.enjoyor.soa.traffic.util.pojo.Page;
import com.enjoyor.soa.traffic.util.pojo.ResultPojo;

@SuppressWarnings("rawtypes")
@Service(version = "1.0.0", timeout = 4000)
public class DubboRltRoutePostService implements IDubboRltRoutePostService{


	@Autowired
	private IRltRoutePostService iRltRoutePostService;
	
	@Override
	public ResultPojo getRouteRltPostPage(Page page, String taskId, String routeId, String postId, String isHandle) {
		// TODO Auto-generated method stub
		ResultPojo resultPojo = new ResultPojo(iRltRoutePostService.getRltRoutePostPage(page, taskId, routeId, postId, isHandle));
		return resultPojo;
	}

	@Override
	public ResultPojo getRouteRltPostList(String taskId, String routeId, String postId, String isHandle) {
		// TODO Auto-generated method stub
		List<RltRoutePost> list = iRltRoutePostService.getRltRoutePostList(taskId, routeId, postId, isHandle);
		ResultPojo resultPojo = new ResultPojo(ReflectHelper.listToList(list, RltRoutePostDto.class));
		return resultPojo;
	}

	@Override
	public ResultPojo deleteRouteRltPost(String postId, String personName) {
		// TODO Auto-generated method stub
		ResultPojo resultPojo = new ResultPojo();
		iRltRoutePostService.deleteRltRoutePost(postId, personName);
		return resultPojo;
	}

	@Override
	public ResultPojo updateRouteRltPost(RltRoutePostDto rltRoutePostDto, String personName) {
		// TODO Auto-generated method stub
		iRltRoutePostService.editRltRoutePost(ReflectHelper.beanToBean(rltRoutePostDto, RltRoutePost.class), personName);
		return new ResultPojo();
	}

	@Override
	public ResultPojo rltRoutePostList(List<RltRoutePostDto> list, String taskId, String routeId, String personName) {
		// TODO Auto-generated method stub
		List<RltRoutePost> listRltRoutePost = DomainUtil.merge2ListJson(list, RltRoutePost.class);
		iRltRoutePostService.rltRoutePostList(listRltRoutePost, taskId, routeId, personName);
		return new ResultPojo();
	}

	@Override
	public ResultPojo insertRouteRltPost(RltRoutePostDto rltRoutePostDto, String personName) {
		// TODO Auto-generated method stub
		iRltRoutePostService.insertRltRoutePost(ReflectHelper.beanToBean(rltRoutePostDto, RltRoutePost.class), personName);
		ResultPojo resultPojo = new ResultPojo();
		return resultPojo;
	}
}
